Control device

ABSTRACT

The present disclosure meets demand to realize control computations according to programs having different execution formats by a single control device. The control device includes a storage unit storing a first program to be scanned as a whole for each execution and a second program that is sequentially executed, an execution processing unit computing a first command value by executing the first program at every predetermined control cycle, an interpreter interpreting at least a part of the second program and generating an intermediate code, a command value computation unit computing a second command value at every control cycle according to the intermediate code generated in advance by the interpreter, and an output unit outputting the first command value computed by the execution processing unit and the second command value computed by the command value computation unit at every control cycle.

CROSS-REFERENCE TO RELATED APPLICATION

This application claims the priority benefit of Japanese PatentApplication Laid-Open (JP-A) no. 2017-155781, filed on Aug. 10, 2017.The entirety of each of the above-mentioned patent applications ishereby incorporated by reference herein and made a part of thisspecification.

BACKGROUND Technical Field

The present disclosure relates to a control device for controlling acontrol object.

Description of Related Art

In various production sites, factory automation (FA) technology using acontrol device such as a programmable logic controller (PLC) is widelyused. Such a control device not only directly controls a control objectbut also indirectly controls a control object by giving a controlcommand to another device in some cases. For example, in Japanese PatentApplication Publication No. 2013-134786 (Patent Literature 1), a systemincluding a machine tool and a PLC connected to the machine tool isdisclosed.

Meanwhile, with the advance of information and communication technology(ICT) in recent years, a processing capability of a control device hasdramatically improved. There is also demand to integrate a controlsystem realized by using a plurality of dedicated devices into a smallernumber of control devices in the related art. For example, in JapanesePatent Application Publication No. 2012-194662 (Patent Literature 2), aconfiguration in which a motion computation program and a user programare executed in synchronization with each other in a central processingunit (CPU) of a PLC is disclosed. According to the configurationdisclosed in Japanese Patent Application Publication No. 2012-194662(Patent Literature 2), a user program such as a sequence program and amotion computation program may be executed inassociation/synchronization with each other.

SUMMARY

According to an embodiment of the present disclosure, a control devicefor controlling a control object is provided. The control deviceincludes a storage unit configured to store a first program to bescanned as a whole for each execution and a second program that issequentially executed, an execution processing unit configured tocompute a first command value by executing the first program at everypredetermined control cycle, an interpreter configured to interpret atleast a part of the second program and generate an intermediate code, acommand value computation unit configured to compute a second commandvalue at every control cycle according to the intermediate codegenerated in advance by the interpreter, and an output unit configuredto output the first command value computed by the execution processingunit and the second command value computed by the command valuecomputation unit at every control cycle.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic diagram illustrating an overall configurationexample of a control system according to the present embodiment.

FIG. 2 is a block diagram illustrating a hardware configuration exampleof the control device according to the present embodiment.

FIG. 3 is a schematic diagram illustrating an overall configurationexample of a computer numerical control (CNC) machining system accordingto the related art of the present disclosure.

FIG. 4 is a schematic diagram illustrating an example of an executiontiming of a program in the CNC machining system according to the relatedart of the present disclosure illustrated in FIG. 3.

FIG. 5 is a schematic diagram illustrating an overall configurationexample of a robot assembly system according to the related art of thepresent disclosure.

FIG. 6 is a schematic diagram illustrating an example of a functionalconfiguration of a control device according to the present embodiment.

FIG. 7 is a schematic diagram illustrating an example of an executioncycle of each functional configuration in the control device accordingto the present embodiment.

FIG. 8 is a schematic diagram illustrating an example of an executiontiming of a program in the control device according to the presentembodiment.

FIG. 9 is a schematic diagram illustrating another example of anexecution timing of a program in the control device according to thepresent embodiment.

FIG. 10 is a schematic diagram conceptually illustrating an intermediatecode generated in the control device according to the presentembodiment.

FIG. 11 is a schematic diagram for describing an example of generationof the intermediate code in the control device according to the presentembodiment.

FIG. 12 is a flowchart illustrating a processing procedure in thecontrol device according to the present embodiment.

DESCRIPTION OF THE EMBODIMENTS

An embodiment of the present disclosure will be described in detail withreference to the drawings. Like or corresponding parts in the drawingsare denoted by like reference numerals, and description thereof will notbe repeated.

It is assumed that demand to realize the control computations accordingto a plurality of types of programs having different execution formatsby a single control device is increased. An object of one or someexemplary embodiments of the present disclosure is to provide a controldevice capable of meeting such demand.

According to an aspect of the present disclosure, a control device forcontrolling a control object is provided. The control device includes astorage unit configured to store a first program to be scanned as awhole for each execution and a second program that is sequentiallyexecuted, an execution processing unit configured to compute a firstcommand value by executing the first program at every predeterminedcontrol cycle, an interpreter configured to interpret at least a part ofthe second program and generate an intermediate code, a command valuecomputation unit configured to compute a second command value at everycontrol cycle according to the intermediate code generated in advance bythe interpreter, and an output unit configured to output the firstcommand value computed by the execution processing unit and the secondcommand value computed by the command value computation unit at everycontrol cycle.

According to an embodiment of the disclosure, the interpreter may updatedata shared with the execution processing unit at every synchronizationcycle, which is an integer multiple of the control cycle.

According to an embodiment of the disclosure, the interpreter maytemporarily stop interpretation of the second program before thesynchronization cycle comes.

According to an embodiment of the disclosure, the intermediate code mayinclude a function for the command value computation unit to compute thesecond command value at every control cycle.

According to an embodiment of the disclosure, the interpreter maysequentially queue the generated intermediate code in the buffer, andthe command value computation unit may read the intermediate code in anorder in which the intermediate code is queued in the buffer.

According to an embodiment of the disclosure, the intermediate code mayinclude a function that takes time of the control cycle as an input anda command value as an output.

According to an embodiment of the disclosure, the control device mayinclude a plurality of sets of the interpreter and the command valuecomputation unit.

According to an embodiment of the disclosure, the execution processingunit, the command value computation unit, and the output unit may beexecuted as high priority tasks, and the interpreter may be executed asa low priority task.

According to an embodiment of the disclosure, an execution time of thehigh priority task may be assigned to each control cycle, and the lowpriority task may be executed at a time other than the execution time ofthe high priority task.

According to an embodiment of the disclosure, the control device mayhave a processor having a plurality of cores, and the high priority taskmay be executed in a first core while the low priority task is executedin a second core.

According to one or some exemplary embodiments of the presentdisclosure, the control computations according to a plurality of typesof programs having different execution formats can be realized by asingle control device.

A. Terms

First, the terms used in the present specification will be described.

In the present specification, the term “IEC program” (one example of thefirst program) is a term encompassing a program in which the whole isscanned every time the program is executed and one or more commandvalues are computed at every execution. Typically, the “IEC program”includes a program consisting of one or more instructions described inaccordance with the International Standard IEC61131-3 defined by theInternational Electrotechnical Commission (IEC). The “IEC program” mayinclude sequence control and motion control instructions. The “IECprogram” is executed (scanned) as a whole at every control cycle. The“IEC program” is suitable for control that requires immediacy and highspeed. The “IEC program” is not limited to the instructions described inaccordance with the International Standard IEC61131-3, and may includean instruction that is independently defined by a manufacturer, avender, or the like of a programmable logic controller (PLC).

In the present specification, “sequence control” is basically a methodof sequentially executing a program (a sequence program) described byone or more logic circuits configured to compute an input value, anoutput value, an internal value, and the like, from the beginning to theend. In one control cycle, the program is executed from the beginning tothe end, and in the subsequent control cycle, the program is executedagain from the beginning to the end. The sequence program is a programexpressing an electrical circuit.

In the present specification, “motion control” is a method of computingnumerical values such as position, velocity, acceleration, jerk, angle,angular velocity, angular acceleration, angular jerk, and the like ascommands for an actuator such as a servo motor. Even in “motioncontrol,” in one control cycle, a program (motion program) described bya function block, a numerical expression, or the like is executed fromthe beginning to the end. That is, a command value is computed (updated)every control cycle.

In the present specification, “control application” includes a device ora machine performing specific machining or operation and control thereofusing, for example, computer numerical control (CNC) and/or a robot.

In the present specification, “application program” (one example of thesecond program) includes a program consisting of one or moreinstructions for realizing a control application, and basically includesa program which is not included in the “IEC program.” The “applicationprogram” is a program expressing the procedure of the controlapplication. For example, the application program is described using theG-language in the CNC, and is described using the robot language in therobot control. These application programs often employ an interpretermethod which is sequentially executed line by line.

In the present specification, “user program (also abbreviated as “UPG”)”includes a program that can be arbitrarily created by a user. The “userprogram” may include the sequence program for realizing the sequencecontrol, the motion program for realizing the motion control, and theapplication program.

B. Overall Configuration Example of Control System

First, an overall configuration example of a control system 1 includinga control device according to the present embodiment will be described.

FIG. 1 is a schematic diagram illustrating an overall configurationexample of the control system 1 according to the present embodiment. InFIG. 1, the control system 1 focusing on a control device 100 accordingto the present embodiment is shown.

The control device 100 corresponds to an industrial controller thatcontrols a control object such as various facilities and devices. Thecontrol device 100 is a type of computer that executes a controlcomputation, which will be described below, and may typically beimplemented as a PLC (programmable logic controller). The control device100 may also be connected to various field devices 500 via a fieldnetwork 2. The control device 100 transmits and receives data to andfrom the one or more field devices 500 via the field network 2 or thelike. Generally, although “field network” is also referred to as “fieldbus,” in the following description, the “field bus” and the “fieldnetwork” will be collectively referred to as “field network” forsimplicity of description. That is, the “field network” in the presentspecification is a concept that may include a “field bus” in addition toa “field network” in a narrow sense.

The control computation executed in the control device 100 includes aprocess (inputting process) of collecting data collected or generated inthe field device 500 (hereinafter also referred to as “input data”), aprocess (computation process) of generating data such as commands forthe field device 500 (hereinafter also referred to as “output data”),and a process (outputting process) of transmitting the generated outputdata to a target field device 500.

The field network 2 may employ a bus or network that performsfixed-period communication in which a data arrival time is guaranteed.EtherCAT (registered trademark), EtherNet/IP (registered trademark),DeviceNet (registered trademark), CompoNet (registered trademark), andthe like are known as a bus or a network for performing suchfixed-period communication.

An arbitrary field device 500 may be connected to the field network 2.The field device 500 includes an actuator configured to give somephysical action to a manufacturing device, a production line, or thelike (hereinafter also collectively referred to as “field”), and aninput/output (I/O) device configured to exchange information betweenfields.

Although data is exchanged between the control device 100 and the fielddevice 500 via the field network 2, the data exchanged therebetween isupdated in a very short cycle of several hundred μsec to several tens ofmsec order. The process of updating data transmitted and receivedtherebetween is also referred to as an I/O refresh process.

In the configuration example illustrated in FIG. 1, the field device 500includes a remote input/output (I/O) device 510, a servo driver 520 anda servo motor 522, a robot system 530, and a CNC machining device 540.The field device 500 is not limited to the above, and an arbitrarydevice configured to collect input data (for example, a visual sensor orthe like), an arbitrary device configured to give some action accordingto output data (for example, an inverter device or the like), and thelike may be employed as the field device 500.

Typically, the remote I/O device 510 includes a communication couplerconfigured to perform communication via the field network 2, and an I/Opart (hereinafter referred to as “I/O unit”) configured to performacquisition of input data and output of output data.

The remote I/O device 510 is connected to a device configured to collectinput data such as an input relay and various sensors (for example, ananalog sensor, a temperature sensor, a vibration sensor, and the like)and a device configured to give some action to a field such as an outputrelay, a contactor, a servo driver, and other arbitrary actuators.

The servo driver 520 drives the servo motor 522 according to output data(for example, a position command, a speed command, or the like) from thecontrol device 100.

The robot system 530 includes a robot controller 532 and robotmechanisms 534, 536, and 538. The robot controller 532 calculates atrajectory, calculates an angle of each axis, etc. according to aposition command or the like from the control device 100, and accordingto a result of calculations, drives a servo motor and the likeconstituting the robot mechanisms 534, 536, and 538. In theconfiguration example illustrated in FIG. 1, the robot mechanism 534 isa parallel robot, the robot mechanism 536 is a SCARA robot, and therobot mechanism 538 is an articulated robot. The robots are not limitedto the mechanisms illustrated in FIG. 1, and any mechanism may beemployed in the robots. Although a configuration in which the robotcontroller 532 and the robot mechanisms 534, 536, and 538 are separatedis exemplified for convenience of description, embodiments are notlimited thereto, and the robot controller 532 and the robot mechanisms534, 536, and 538 may also be integrated with each other.

The CNC machining device 540 controls a machining center or the likeaccording to a program for specifying a position, a speed, or the like,thereby machining an arbitrary object. Typically, the CNC machiningdevice 540 includes machining devices for lathe machining, milling,electric discharge machining, and the like.

The control device 100 is also connected to other devices via a hostnetwork 6. Ethernet (registered trademark) or EtherNet/IP (registeredtrademark), which is a general network protocol, may be employed as thehost network 6. More specifically, one or more server devices 300 andone or more display devices 400 may also be connected to the hostnetwork 6.

The server device 300 is assumed to be a database system, amanufacturing execution system (MES), or the like. The MES systemacquires information from a manufacturing device or facility to becontrolled, and monitors and manages the overall production, and mayhandle order information, quality information, shipping information, andthe like. Embodiments are not limited thereto, and a device providing aninformation system service may also be connected to the host network 6.The information system service is assumed to be a process of acquiringinformation from a manufacturing device or facility to be controlled andperforming a macroscopic or microscopic analysis and the like. Forexample, the information system service is assumed to be data mining forextracting some characteristic tendencies included in information from amanufacturing device or facility to be controlled, or a machine learningtool for performing machine learning based on information from afacility or machine to be controlled.

Upon receiving an operation from a user, the display device 400 outputsa command or the like corresponding to a user operation to the controldevice 100 and graphically displays a computation result or the like inthe control device 100.

Further, a support device 200 can be connected to the control device100. The support device 200 is a device that supports preparationsnecessary for the control device 100 to control a control object.Specifically, the support device 200 provides a development environment(a program creation editing tool, parser, compiler, and the like) of aprogram executed in the control device 100, a setting environment forsetting the control device 100 and parameters (configurations) ofvarious devices connected to the control device 100, a function ofoutputting a generated user program to the control device 100, afunction of correcting/changing a user program or the like executed onthe control device 100 online, and the like.

C. Hardware Configuration Example of Control Device

Next, a hardware configuration example of the control device 100according to the present embodiment will be described.

FIG. 2 is a block diagram illustrating a hardware configuration exampleof the control device 100 according to the present embodiment. Althougha general PLC is configured by a computation processing unit, which isreferred to as a CPU, and one or more I/O units 122, these arecollectively drawn in FIG. 2.

Referring to FIG. 2, the control device 100 includes a processor 102, achip set 104, a main memory 106, a secondary memory 108 (one example ofthe storage unit), a host network controller 110, a universal serial bus(USB) controller 112, a memory card interface 114, an internal buscontroller 120, and a field network controller 130.

The processor 102 is constituted by a CPU, a micro processing unit(MPU), a graphics processing unit (GPU), or the like. A configurationhaving a plurality of cores may be employed as the processor 102, or aplurality of processors 102 may be arranged. The chip set 104 realizesprocessing of the entire control device 100 by controlling the processor102 and each device. The main memory 106 is constituted by a volatilememory such as a dynamic random access memory (DRAM) or a static randomaccess memory (SRAM). The secondary memory 108 is, for example,constituted by a nonvolatile memory such as a hard disk drive (HDD) or asolid state drive (SSD).

The processor 102 reads various programs stored in the secondary memory108, develops the programs in the main memory 106, and executes theprograms, thereby realizing control according to a control object andvarious processes, which will be described below. In addition to asystem program 36 for realizing basic functions, user programs (an IECprogram 30 and an application program 32) created in accordance with amanufacturing device or facility to be controlled are stored in thesecondary memory 108.

The host network controller 110 controls exchange of data with theserver device 300, the display device 400 (see FIG. 1), or the like viathe host network 6. The USB controller 112 controls exchange of datawith the support device 200 via a USB connection.

The memory card interface 114 includes a memory card 116 detachablyattached thereto, and can record data in the memory card 116 and readvarious pieces of data (user program, trace data, and the like) from thememory card 116.

The internal bus controller 120 controls exchange of data with the I/Ounit 122 embedded in the control device 100. The field networkcontroller 130 controls exchange of data with another device via thefield network 2.

Although a configuration example in which necessary functions areprovided by the processor 102 executing a program is illustrated in FIG.2, some or all of the provided functions may also be implemented using adedicated hardware circuit (for example, an application-specificintegrated circuit (ASIC), a field-programmable gate array (FPGA), orthe like). Alternatively, a main part of the control device 100 may berealized using hardware complying with a general-purpose architecture(for example, an industrial personal computer (PC) based on ageneral-purpose PC). In this case, using a virtualization technology, aplurality of operating systems (OSs) having different uses may beexecuted in parallel, and a necessary application may be executed oneach of the OSs.

Although the control device 100, the support device 200, and the displaydevice 400 are separately configured in the control system 1 illustratedin FIG. 1 described above, a configuration in which some or all of thefunctions thereof are integrated into a single device may also beemployed.

D. Related Art

Next, before the configuration and functions of the control device 100according to the present embodiment are described in detail, the relatedart will be described.

(d1: CNC Machining System)

FIG. 3 is a schematic diagram illustrating an overall configurationexample of a CNC machining system 1A according to the related art of thepresent disclosure. Referring to FIG. 3, the CNC machining system 1Aincludes a CNC machining device 600 and a conveying device 650configured to supply a workpiece W to the CNC machining device 600.

The CNC machining device 600 is driven by a CNC controller 610, and theconveying device 650 is driven by a PLC 100A. Because the CNC machiningdevice 600 and the conveying device 650 need to be linked, both the CNCcontroller 610 and the PLC 100A are connected to a host controller 10A.The host controller 10A gives commands to the CNC controller 610 and thePLC 100A.

The CNC controller 610 generates a command for driving the CNC machiningdevice 600 according to a command from the host controller 10A, andcontrols the operation of the CNC machining device 600.

The PLC 100A periodically executes an IEC program 101A to performcontrol of a driving motor 652 of the conveying device 650, or the like.Typically, instructions for realizing sequence control and motioncontrol are described in the IEC program 101A, and these instructionsare repeatedly executed at a common control cycle so that the sequencecontrol and the motion control are executed in synchronizationtherewith. More specifically, the PLC 100A computes output dataaccording to the sequence control by using input data and internal dataacquired through the remote I/O device 510, and outputs an output signalin accordance with the computed output data from the remote I/O device510. By giving a command value computed in the motion control to theservo driver 520, the PLC 100A appropriately conveys the workpiece W bythe conveying device 650.

A configuration in which the sequence control and the motion control areexecuted in the same PLC 100A is disclosed in the above-mentionedJapanese Patent Application Publication No. 2012-194662 (PatentLiterature 2).

On the other hand, control over the CNC machining device 600 is realizedby the CNC controller 610 separately disposed from the PLC 100A. The CNCcontroller 610 sequentially executes commands described in a CNC program620 to realize predetermined machining and the like for the workpiece W.

Because the PLC 100A and the CNC controller 610 execute independentcontrol processes, the PLC 100A and the CNC controller 610 exchangeinformation on each device via an I/O signal (an I/O signal line 512) tooperate the conveying device 650 and the CNC machining device 600 inlinkage with each other. Such an I/O signal includes, for example, anoperation start command or the like output from the PLC 100A. In such aconfiguration, a digital signal indicating the start of machining isgiven from the remote I/O device 510 to the CNC controller 610.

In the case of employing a configuration in which state values areexchanged between devices via such an I/O signal, for example, when aworkpiece W before machining is disposed in the CNC machining device600, or a machined workpiece W is withdrawn from the CNC machiningdevice 600, the CNC machining device 600 and the conveying device 650cannot be perfectly synchronized. Therefore, because a control timing isnot synchronized between the CNC machining device 600 and the conveyingdevice 650 (or still another device), waiting for processing occurs.Such waiting for processing is a factor that impedes shortening ofprocessing time.

An execution timing of each program in the system according to therelated art of the present disclosure will be described.

FIG. 4 is a schematic diagram illustrating an example of executiontiming of a program in the CNC machining system 1A according to therelated art of the present disclosure shown in FIG. 3. For convenienceof description, in FIG. 4, the execution time of each program is drawnby scaling to an arbitrary size and does not reflect the actualexecution time. This also applies to the following similar drawings.

The part A of FIG. 4 shows a state in which the IEC program 101A isperiodically executed by the PLC 100A, and the part B of FIG. 4 shows astate in which the CNC program 620 is sequentially executed by the CNCcontroller 610.

As illustrated in the part A of FIG. 4, in the PLC 100A, the IEC program101A is periodically executed at every control cycle of a predeterminedlength. The IEC program 101A may include instructions for sequenceprocessing and/or motion processing. These instructions may be describedin the same program.

Prior to the execution of the IEC program 101A, an I/O refresh process20 (also referred to as “I/O” in the drawings) for updating input dataand output data is executed. In the I/O refresh process 20, input datais acquired from a field via the remote I/O device 510 or the like, andoutput data computed by the IEC program 101A in the immediatelypreceding control cycle is given to the field via the remote I/O device510 or the like.

In this way, the entire content (codes) of the IEC program 101A isscanned at every control cycle. In each control cycle, processing suchas communication is executed during an in-between period in which theIEC program 101A is not executed.

As illustrated in the part B of FIG. 4, commands described in the CNCprogram 620 are sequentially executed. That is, the CNC program 620 isexecuted by an interpreter method. More specifically, first, afirst-line code of the CNC program 620 is executed, and after theexecution thereof is completed, a second-line code is executedcontinuously. In this way, the codes described in the CNC program 620are sequentially executed.

An interruption is given during the execution of the CNC program 620 sothat a communication process 22 is executed.

Because properties of the IEC program 101A executed by the PLC 100A andthe CNC program 620 executed by the CNC controller 610 are different, ascan be recognized when the part A of FIG. 4 and the part B of FIG. 4 arecompared, different control devices for respectively executing theprograms are prepared in the related art.

(d2: Robot Assembly System)

FIG. 5 is a schematic diagram illustrating an overall configurationexample of a robot assembly system 1B according to the related art ofthe present disclosure. Referring to FIG. 5, the robot assembly system1B includes an articulated robot 700 and an XY stage 750 configured tohold a workpiece W. FIG. 5 shows an application example in which a partgripped by a distal end of the articulated robot 700 is inserted into ahole provided in the workpiece W.

The articulated robot 700 is driven by a robot controller 710, and theXY stage 750 is driven by a PLC 100B. Because the articulated robot 700and the XY stage 750 need to be linked, both the robot controller 710and the PLC 100B are connected to a host controller 10B. The hostcontroller 10B gives commands to the robot controller 710 and the PLC100B.

The PLC 100B periodically executes an IEC program 101B to performcontrol of a servo motor 752 configured to drive the X-axis of the XYstage 750, a servo motor 754 configured to drive the Y-axis of the XYstage 750, and the like. Typically, instructions for realizing sequencecontrol and motion control are described in the IEC program 101B, andthese instructions are repeatedly executed at a common control cycle sothat the sequence control and the motion control are executed insynchronization. More specifically, the PLC 100B computes output dataaccording to the sequence control by using input data and internal dataacquired by the remote I/O device 510, and outputs an output signal inaccordance with the computed output data from the remote I/O device 510.By giving a command value computed in the motion control to each servodriver 520, the PLC 100B locates the workpiece W disposed on the XYstage 750 at an appropriate position.

On the other hand, control over the articulated robot 700 is realized bythe robot controller 710 separately disposed from the PLC 100B. Therobot controller 710 sequentially executes commands described in a robotprogram 720 so that the articulated robot 700 performs a predeterminedbehavior.

Because the PLC 100B and the robot controller 710 execute independentcontrol processes, the PLC 100B and the robot controller 710 exchangeinformation on each device via an I/O signal (an I/O signal line 514) tooperate the XY stage 750 and the articulated robot 700 in linkage witheach other. Such an I/O signal includes, for example, an operation startcommand or the like output from the PLC 100B. In such a configuration, adigital signal indicating the start of machining is given from theremote I/O device 510 to the robot controller 710.

In the case of employing a configuration in which state values areexchanged between devices via such an I/O signal, for example, when aworkpiece W before machining is disposed at a predetermined position, ora machined workpiece W is withdrawn, the articulated robot 700 and theXY stage 750 cannot be perfectly synchronized. Therefore, because acontrol timing is not synchronized between the articulated robot 700 andthe XY stage 750 (or still another device), waiting for processingoccurs. Such waiting for processing is a factor that impedes shorteningof processing time. Further, because the operation of the XY stage 750and the operation of the articulated robot 700 are not synchronized,when operating the articulated robot 700 while operating the XY stage750, the operation timings do not match, and this becomes a factor thatlowers assembling accuracy.

(d3: System in Which Robot Controller is Master Controller)

As disclosed in the above-described Japanese Patent ApplicationPublication No. 2013-134786 (Patent Literature 1), a system in which arobot controller is disposed as a master controller, and the robotcontroller mainly controls a robot and a motor is also assumed. In thissystem, the robot controller gives an instruction to start operation orend operation to each of one or more robots. In this system, although aplurality of robots can be synchronized with a motor, an operation startcommand for the robot controller needs to be given from anothercontroller. Therefore, it is not possible to control all elements of thesystem with a single robot controller.

E. Control Device According to the Present Embodiment

The control device 100 according to the present embodiment has afunction capable of solving the above-described problems that occur inthe related art. Specifically, the control device 100 provides anenvironment in which the IEC program 30 (including a sequence commandand/or a motion command) and the application program 32 can be executedin synchronization with each other.

FIG. 6 is a schematic diagram illustrating an example of a functionalconfiguration of the control device 100 according to the presentembodiment. Referring to FIG. 6, the control device 100 includes an IECprogram processing unit 150 (one example of the execution processingunit), a motion processing unit 152, a field network interface 180 (oneexample of the output unit), a host network interface 182, and one ormore control application processing units 160-1, 160-2, . . .(hereinafter also collectively referred to “control applicationprocessing unit 160”, one example of the command value computationunit).

FIG. 6 shows a configuration example in which the control device 100controls a control application 1 and a control application 2. Typically,each of the control application 1 and the control application 2 includesan I/O device such as a relay or a contactor and various actuators suchas a servo motor. In addition to the control application 1 and thecontrol application 2, other I/O devices and various sensors are alsoconnected to the control device 100 via the field network 2.

The field network interface 180 of the control device 100 mediates theexchange of data between the IEC program processing unit 150 and thecontrol application processing unit 160, and the devices connected viathe field network 2.

The control device 100 receives an instruction to start or endproduction from the server device 300 connected via the host network 6.The server device 300 transmits the application program 32 for operatingthe control application, recipe information (information on parametersappropriate for production), and the like to the control device 100 insome cases.

The host network interface 182 of the control device 100 mediates theexchange of data between the IEC program processing unit 150 and thecontrol application processing unit 160, and the devices connected viathe host network 6.

The IEC program processing unit 150 executes (scans) the IEC program 30(one example of the first program) at every predetermined control cycleand computes one or more command values (one example of the firstcommand value). That is, the IEC program processing unit 150 computescommand values at every control cycle according to the IEC program 30.

The motion processing unit 152 provides a function of computing acommand value at every control cycle according to a motion commandincluded in the IEC program 30. That is, the motion command included inthe IEC program 30 includes a command that instructs a behavior over aplurality of control cycles (for example, a command for drawing acertain trajectory). When such a motion command is executed, accordingto instruction content of the executed motion command, the motionprocessing unit 152 computes a command value at every control cycle.That is, the motion processing unit 152 outputs a command value at everycontrol cycle to realize the behavior instructed by the motion command.

The control application processing unit 160 computes a command value forcontrolling the control application on the basis of the applicationprogram 32, the recipe information, and the like received from theserver device 300 or the like. The control application processing unit160 computes and outputs a command value for the control application, insynchronization with the IEC program processing unit 150 computing andoutputting a command value. That is, the control application processingunit 160 executes a command value computing process in synchronizationwith the computing process by the IEC program processing unit 150.

To realize command value computation synchronized with the command valuecomputing process by the IEC program processing unit 150, the controlapplication processing unit 160 includes buffers 164-1, 164-2, . . .(hereinafter collectively referred to as “buffer 164”), motionprocessing units 166-1, 166-2, . . . (hereinafter collectively referredto as “motion processing unit 166”), and interpreters 168-1, 168-2, . .. (hereinafter collectively referred to as “interpreter 168”).

The interpreter 168 interprets at least a part of the applicationprogram 32 (application programs 32-1, 32-2, . . . ) and generates anintermediate code 34 (intermediate codes 34-1, 34-2, . . . ). That is,the interpreter 168 sequentially executes the application program 32(one example of the second program), generates the intermediate code 34,and stores the generated intermediate code 34 into a buffer 164corresponding thereto.

The motion processing unit 166 (one example of the command valuecomputation unit) computes a command value (one example of the secondcommand value) at every control cycle according to the intermediate code34 generated in advance by the interpreter 168. That is, the motionprocessing unit 166 provides a function of computing a command value atevery control cycle according to the intermediate code 34 pre-stored inthe buffer 164. Generally, because commands (codes) described in theapplication program 32 are sequentially executed and thus a commandvalue computation cycle cannot be guaranteed, by using the intermediatecode 34, the motion processing unit 166 may compute a command value atevery control cycle. A coordinate system in accordance with each controlapplication may be used in a command described in the intermediate code34.

In this way, the interpreter 168 sequentially queues the generatedintermediate code 34 to the buffer 164, and the motion processing unit166 reads the intermediate code 34 in an order in which the intermediatecoder 34 is queued in the buffer 164.

In the present specification, “intermediate code” is a concept includinga command for computing a command value at every control cycle. The“intermediate code” includes one or more commands or one or morefunctions. In the present embodiment, the intermediate code 34 may beany code as long as the motion processing unit 166 can compute a commandvalue at every control cycle. An example of the intermediate code 34will be described below.

The field network interface 180 outputs one or more command values(basically, logical values) computed by the IEC program processing unit150, one or more command values (basically, numerical values) computedby the motion processing unit 152, and one or more command values(basically, numerical values) computed by the motion processing unit 166to a field at every control cycle.

To share data between the IEC program processing unit 150 and thecontrol application processing unit 160, shared memories 162-1, 162-2, .. . (hereinafter also collectively referred to as “shared memory 162”)are provided. In a configuration example illustrated in FIG. 6, some orall of the processing results by the control application processing unit160 are stored in the shared memory 162, and the IEC program processingunit 150 may refer to data stored in the shared memory 162 of thecontrol application processing unit 160. Data may be written from theIEC program processing unit 150 to the shared memory 162 of the controlapplication processing unit 160, and the data recorded from the IECprogram processing unit 150 as above may be referred to from theinterpreter 168 and the motion processing unit 166. A structure variablemay also be employed when storing data in the shared memory 162.

In this way, the control application processing unit 160 includes theapplication program 32, which is a user program for controlling acontrol application, the interpreter 168, the motion processing unit 166for computing a command value. The application program 32 is assumed tobe, for example, a program for controlling a machine tool, a program forcontrolling an assembly machine (robot), or the like, in accordance witha control application.

As illustrated in FIG. 6, when a plurality of control applications arecontrolled, flexible expansion is possible by arranging a plurality ofsets of the interpreter 168 and the motion processing unit 166 in thecontrol device 100.

F. Synchronous Execution of Program

Next, synchronous execution of a program in the control device 100according to the present embodiment will be described.

FIG. 7 is a schematic diagram illustrating an example of an executioncycle of each functional configuration in the control device 100according to the present embodiment. Referring to FIG. 7, theinterpreter 168 of the control application processing unit 160sequentially executes the application program 32 at every cycle longerthan a control cycle. In an example illustrated in FIG. 7, theinterpreter 168-1 of the control application processing unit 160-1sequentially executes the application program 32 at every cycle that istwo times longer than the control cycle, and the interpreter 168-2 ofthe control application processing unit 160-2 sequentially executes theapplication program 32 at every cycle that is four times longer than thecontrol cycle.

Here, both the motion processing unit 152 of the IEC program processingunit 150 and the motion processing unit 166 of the control applicationprocessing unit 160 compute a command value at every identical controlcycle. That is, all outputs of a command value from the control device100 are performed in synchronization with a predetermined control cycle.In this way, the IEC program processing unit 150 and the controlapplication processing unit 160 have respective motion processing unitsfor continuously controlling an operation of an actuator, and by thesemotion processing units computing command values in synchronization witheach other, both the control according to the IEC program 30 and thecontrol according to the application program 32 may be executed insynchronization with the control cycle, and therefore, accurate controlcan be realized in each control cycle unit.

Next, execution timings of the IEC program 30 and the applicationprogram 32 in the control device 100 according to the present embodimentwill be described. FIG. 8 is a schematic diagram illustrating an exampleof execution timings of programs in the control device 100 according tothe present embodiment.

FIG. 8 shows an example in which a plurality of tasks are set for eachpriority, and each of the tasks shares a resource of the processor 102according to priority thereof.

In an example illustrated in FIG. 8, executions of the field networkinterface 180, the IEC program processing unit 150, and the motionprocessing unit 166 of the control application processing unit 160 areset as high priority tasks, and execution of the interpreter 168 of thecontrol application processing unit 160 is set as a low priority task.That is, the I/O refresh process 20, the process of executing the IECprogram 30, the command value computing process in accordance with theIEC program 30, and the command value computing process in accordancewith the application program 32 are executed as high priority tasks. Onthe other hand, the process of sequentially interpreting the applicationprogram 32 is executed as a low priority task.

The high priority tasks are repeatedly executed at every predeterminedcontrol cycle T1. The t1, t2 and t3 shown in FIG. 8 represent tune. Thelow priority task is executed every time during a period in which thehigh priority tasks are not executed. That is, in every control cycle,execution time for the high priority tasks is assigned, and the lowpriority task is executed during time other than the execution time forthe high priority tasks.

First, the high priority tasks will be described. When each controlcycle comes, first, the I/O refresh process 20 is executed, and then theentire IEC program 30 is executed (scanned) by the IEC programprocessing unit 150 so that one or more command values related tosequence control are computed. Further, motion processing related to amotion command included in the IEC program 30 is executed by the motionprocessing unit 152 such that one or more command values related to themotion command are computed. Also, an intermediate code is read(dequeued) from the buffer 164 by the motion processing unit 166 of thecontrol application processing unit 160 such that a command value inthat control cycle is computed. Hereinafter, the same process isrepeated for each control cycle.

The timing (dequeuing timing) at which the motion processing unit 166reads the intermediate code from the buffer 164 may not be each controlcycle. This is because, in many cases, a read intermediate code includescommands sufficient for computing a command value over a plurality ofcontrol cycles.

When execution of the high priority tasks in a certain control cycle iscompleted as above, a set of a command value related to sequencecontrol, a command value related to motion control, a command valuerelated to a control application is prepared. These command values arebasically reflected in a field when a subsequent control cycle comes.That is, because the IEC program processing unit 150 and the controlapplication processing unit 160 compute command values according toinput data at the same control cycle, the output in synchronization withthe input may be realized.

On the other hand, the low priority task will be described. Theinterpreter 168 of the control application processing unit 160sequentially executes the application program 32. That is, theinterpreter 168 of the control application processing unit 160 executesreading and interpreting of the application program 32 with lowpriority. An intermediate code generated by the interpreter 168interpreting and processing the application program 32 is sequentiallyqueued (enqueued) to the buffer 164. The intermediate code queued in thebuffer 164 is referred to by the motion processing unit 166 of thecontrol application processing unit 160 every time and used ingenerating a command value.

Here, by queuing intermediate codes for an integer multiple of a controlcycle, which is a computation cycle of the high priority tasks, theinterpreter 168 of the control application processing unit 160 cancompute a command value for a control application at every control cyclewithout affecting the process performed by the motion processing unit166 of the control application processing unit 160. By interpreting andprocessing the application program 32 in advance, the interpreter 168may generate a sufficient number of intermediate codes, which isreferred to by the motion processing unit 166 of the control applicationprocessing unit 160 in computing a command value, in surplus.

The interpreter 168 of the control application processing unit 160executed with low priority temporarily stops the interpreting of theapplication program 32 before a predetermined control applicationsynchronization cycle (an integer multiple of the control cycle) comes.By performing data synchronization between the IEC program processingunit 150 and the control application processing unit 160 at a timing ofthe temporary stop, data matching in both is shared. In this way, theinterpreter 168 updates data shared with the IEC program processing unit150 at every synchronization cycle (that is, control applicationsynchronization cycle), which is an integer multiple of a control cycle.In addition to updating the shared data, input data and output dataacquired from the field may also be updated (data synchronization).

That is, the control application synchronization cycle refers to a cycleof data update or data synchronization set for sequential execution ofthe application program 32 performed by the interpreter 168. When it isset as an integer multiple of a control cycle, the control applicationsynchronization cycle may have any length. The length is appropriatelyset according to the accuracy of control required in the controlapplication.

FIG. 9 is a schematic diagram illustrating another example of anexecution timing of a program in the control device 100 according to thepresent embodiment. FIG. 9 shows an example of execution timing when aplurality of control applications are controlled. Also, FIG. 9 shows anexample in which a high priority task and a low priority task areexecuted in different cores. In the example illustrated in FIG. 9, thehigh priority task and the low priority task are executed in parallel.

As in FIG. 8 described above, the high priority tasks are repeatedlyexecuted at every predetermined control cycle T1. More specifically,when each control cycle comes, first, the I/O refresh process 20 isexecuted, and then the entire IEC program 30 is executed (scanned) bythe IEC program processing unit 150 such that one or more command valuesrelated to sequence control are computed. Further, motion processingrelated to a motion command included in the IEC program 30 is executedby the motion processing unit 152 such that one or more command valuesrelated to the motion command are computed. Also, an intermediate codeis read (dequeued) from the buffer 164-1 by the motion processing unit166-1 of the control application processing unit 160-1 such that acommand value in that control cycle is computed. Then, an intermediatecode is read (dequeued) from the buffer 164-2 by the motion processingunit 166-2 of the control application processing unit 160-2 such that acommand value in that control cycle is computed.

On the other hand, both the application program 32-1 and the applicationprogram 32-2 are executed as the same low priority task. In the exampleillustrated in FIG. 9, a control application synchronization cycle 1 ofthe application program 32-1 is set as two times a control cycle, and acontrol application synchronization cycle 2 of the application program32-2 is set as three times the control cycle.

The interpreter 168-1 of the control application processing unit 160-1and the interpreter 168-2 of the control application processing unit160-2 sequentially execute the application program 32 in accordance withadjustment from a scheduler (not illustrated) or the like.

More specifically, the interpreter 168-1 of the control applicationprocessing unit 160-1 sequentially queues (enqueues) an intermediatecode generated by interpreting and processing the application program32-1 to the buffer 164-1. The interpreter 168-1 of the controlapplication processing unit 160-1 temporarily stops the process at everypredetermined control application synchronization cycle (an integermultiple of the control cycle). At a timing of the temporary stop, datasynchronization is performed between the IEC program processing unit 150and the control application processing unit 160-1, so that data matchingin both is shared.

The interpreter 168-2 of the control application processing unit 160-2sequentially queues (enqueues) an intermediate code generated byinterpreting and processing the application program 32-2 to the buffer164-2. The interpreter 168-2 of the control application processing unit160-2 temporarily stops the process at every predetermined controlapplication synchronization cycle (an integer multiple of the controlcycle). At a timing of the temporary stop, data synchronization isperformed between the IEC program processing unit 150 and the controlapplication processing unit 160-2, so that data matching in both isshared.

Although the control application synchronization cycle 1 of theapplication program 32-1 and the control application synchronizationcycle 2 of the application program 32-2 are different, because boththereof are integer multiples of the control cycle, each of the controlapplication synchronization cycles may synchronize a process thereofwith the IEC program processing unit 150 on the basis of the controlcycle.

When the control device 100 having the processor 102 having a pluralityof cores is employed, a high priority task may be executed in a certaincore, and a low priority task may be executed in another core.

As described above, when a plurality of application programs 32 areexecuted to control a plurality of control applications, the applicationprograms 32 may be executed in parallel with the same priority. In thepresent embodiment, because a method in which execution of theapplication program 32 is temporarily stopped at every controlapplication synchronization cycle, and the intermediate code 34 isqueued for each control cycle unit is employed, limitations on mountingis small.

That is, any method may be employed as a method of assigning a resourceof the processor 102 required for executing the plurality of applicationprograms 32. For example, the method may be a round robin executionmethod in which a common processor (or core) is shared by time-sharing,or an individual core assigning method in which a unique core isassigned to each of the application programs 32. A method in which acommon processor (or core) with a high priority task is shared bytime-sharing may also be employed.

Although an example in which a process is executed in the order of theIEC program processing unit 150, the motion processing unit 152, and themotion processing unit 166 is illustrated in FIGS. 8 and 9, embodimentsare not limited thereto, and the process may be executed in any order aslong as each of the members may complete execution of the process withinthe same control cycle.

G. Intermediate Code

Next, an example of the intermediate code generated by the interpreter168 of the control application processing unit 160 interpreting theapplication program 32 will be described.

FIG. 10 is a schematic diagram conceptually illustrating an intermediatecode generated in the control device 100 according to the presentembodiment. Referring to FIG. 10, the application program 32 includescodes that are sequentially executed by an interpreter method, and timerequired when each of the codes is sequentially executed variesaccording to content described by each of the codes. Therefore,computing a command value at every control cycle is not easy. FIG. 10also illustrates, as an example of the application program 32, a codedescribed with the G-language to be used in CNC.

Accordingly, in the present embodiment, one or more codes described inthe application program 32 are interpreted, and on the basis of theinterpreted content, the intermediate code 34 for computing a commandvalue is generated at every control cycle. Because the intermediate code34 is generated for each of one or more codes described in theapplication program 32, a plurality of intermediate codes 34 aregenerated from a single application program 32 in many cases.

In each of the intermediate codes 34, a function capable of computing acommand value may be specified with time (or duration) of a controlcycle as an input. That is, the intermediate code 34 may be a functionfor the motion processing unit 166 of the control application processingunit 160 to compute a command value at every control cycle. By usingsuch a function, the motion processing unit 166 may compute a commandvalue in each control cycle by sequentially referring to the generatedintermediate code 34.

For example, when a first intermediate code 1 specifies a command valueover a period that is ten times longer than a control cycle, the motionprocessing unit 166 of the control application processing unit 160queues the intermediate code 1 and periodically computes a command valueover the period that is ten times longer than the control cycle.Likewise, an intermediate code 2 and an intermediate code 3, which aredifferent from the intermediate code 1, may also be basically used tocompute a command value over a plurality of control cycles.

Accordingly, when the process of generating an intermediate code fromthe application program 32 by the interpreter 168 of the controlapplication processing unit 160 is executed sufficiently earlier incomparison to the process of computing a command value by the motionprocessing unit 166 of the control application processing unit 160, thecontrol application may be controlled in synchronization with theexecution of the IEC program 30.

FIG. 11 is a schematic diagram for describing an example of generationof the intermediate code in the control device 100 according to thepresent embodiment. Referring to FIG. 11, for example, when theapplication program 32 for specifying a trajectory along which anoperation needs to be performed is sequentially executed, first, theapplication program 32 is interpreted ((1) program interpretation), anda specified trajectory is internally generated ((2) trajectorygeneration). After the relationship between the trajectory and aposition for each control cycle is determined, one or more functionsindicating the internally generated trajectory are generated ((3)generation of function for each section).

In this way, as an example of the intermediate code 34, a function thattakes time of a control cycle as an input and a command value as anoutput may be used.

In an example illustrated in FIG. 11, because the internally generatedtrajectory is a combination of straight lines, functions f1(t), f2(t),and f3(t) that indicate the relationship between time and speed at atrajectory of each straight line section (section 1 to section 3) areoutput.

The functions f1(t), f2(t), and f3(t) output as above correspond toexamples of the intermediate code 34 in the present embodiment. A singlefunction that specifies the trajectory illustrated in FIG. 11 may beoutput as an intermediate code. The intermediate code 34 to be outputmay be appropriately designed in consideration of a required time-widthor the like of a control cycle.

Although the application program using the G-language has been describedabove as an example with reference to FIGS. 10 and 11, embodiments arenot limited thereto, and any language may be used as long as the programis executed by an interpreter method such as an arbitrary robotlanguage. An arbitrary function may be output as the intermediate code34 according to the language.

H. Processing Procedure

Next, a processing procedure in the control device 100 according to thepresent embodiment will be described.

FIG. 12 is a flowchart illustrating a processing procedure in thecontrol device 100 according to the present embodiment. FIG. 12separately shows executions of a high priority task and a low prioritytask.

Referring to FIG. 12, in regard of a high priority task, when a controlcycle comes (YES in Step S100), the field network interface 180 executesthe I/O refresh process (Step S102). Therefore, a command value computedin the immediately preceding control cycle is output to an actuator orthe like, and input data is acquired from a field.

Then, whether the current control cycle matches a control applicationsynchronization cycle is determined (Step S104). When the currentcontrol cycle matches the control application synchronization cycle (YESin Step S104), data synchronization is executed between the IEC programprocessing unit 150 and the control application processing unit 160(Step S106). When the current control cycle does not match the controlapplication synchronization cycle (NO in Step S104), the process of StepS106 is skipped.

Then, the IEC program processing unit 150 executes (scans) the entireIEC program 30 (Step S108). Then, the motion processing unit 152computes a command value in the current control cycle according to amotion command included in the IEC program 30 (Step S110). By Steps S108and S110, a command value for sequence processing and motion processingaccording to the IEC program 30 in the current control cycle iscomputed.

The motion processing unit 166 of the control application processingunit 160 determines whether an intermediate code required for computinga command value is validly read (Step S112). When the intermediate codeis not validly read (NO in Step S112), the motion processing unit 166reads the intermediate code from the buffer 164 (Step S114). When theintermediate code is validly read (YES in Step S112), the process ofStep S114 is skipped.

The motion processing unit 166 of the control application processingunit 160 computes a command value in the current control cycle accordingthe intermediate code (Step S116).

By the above process, a command value in the current control cycle iscomputed. Then, the process following Step S100 is repeated. That is,when the next control cycle comes, the computed command value is outputto a field. A low priority task is executed in a period after Step S116until the next control cycle comes.

In regard of a low priority task, when a control cycle comes (YES inStep S200), whether the current control cycle matches a controlapplication synchronization cycle is determined (Step S202). When thecurrent control cycle matches the control application synchronizationcycle (YES in Step S202), data synchronization is executed between theIEC program processing unit 150 and the control application processingunit 160 (Step S204). Then, the interpreter 168 of the controlapplication processing unit 160 reads, from the application program 32,a code in the range that is executable within the current controlapplication synchronization cycle (Step S206). As an example, acorrespondence relationship for calculating a control cycle required forexecution on the basis of each command and designated parameters and thelike may be implemented in advance in the interpreter 168, and byreferring to the correspondence relationship, the range to which a codewill be read may be determined.

When the current control cycle does not match the control applicationsynchronization cycle (NO in Step S202), the processes of Step S204 andS206 are skipped.

During a period in which execution time of a program is assigned for alow priority task, the interpreter 168 of the control applicationprocessing unit 160 interprets the code read in Step S206 (Step S208),and when a certain intermediate code is generated (YES in Step S210),the generated intermediate code is stored in the buffer 164 (Step S212).Then, the process following Step S200 is repeated.

That is, within the control application synchronization cycle, theprocesses from Steps S208 to S212 are repeated in a period in whichexecution time of a program is assigned for a low priority task.

Although an example in which a single control application is controlledis illustrated in FIG. 12, it is self-evident that similar expansion ispossible even when a plurality of control applications are controlled.

The control device 100 according to the present embodiment has functionof scheduling when a plurality of types of programs having differentexecution formats are executed. The IEC program processing unit 150updates a command value to a field and a feedback value from the field(output data and input data) according to the IEC program 30 at everycontrol cycle. In addition to the fixed-period execution of the IECprogram 30, the control device 100 includes the control applicationprocessing unit 160 for computing a command value at every control cycleaccording to an application program for controlling a controlapplication having specific purposes such asmachining/assembling/inspection realized by a machining tool or robot.

To execute application programs 32 having different execution formatsand control cycles with a common processor by the IEC program 30, thecontrol application processing unit 160 executes a process of computinga command value in a control application in synchronization with acontrol cycle, and sequential executions such as interpreting theapplication program 32 are separately executed from the process ofcomputing a command value.

To maintain data synchronization between the IEC program 30 and theapplication program 32, the control application processing unit 160executes synchronization process of shared data at every controlapplication synchronization cycle (an integer multiple of a controlcycle). That is, at a timing at which the control cycle of the IECprogram processing unit 150 and a clock of the control application aresynchronized, data may be updated while matching therebetween ismaintained.

By employing the control device 100 according to the present embodiment,a control computation in accordance with an IEC program and a controlcomputation in accordance with one or more control applications such asmachining/assembling/inspection being realized by a machine tool, arobot, or the like may be realized with the common control device 100.Therefore, an I/O device and an actuator (motor or the like) connectedto the control device 100, and one or more control applications may becontrolled in synchronization with each other.

By employing the control device 100 according to the present embodiment,delay time or the like that is generated due to waiting between aplurality of devices can be reduced, and thus productivity can beimproved.

By employing the control device 100 according to the present embodiment,because a dedicated controller disposed for each control application canbe omitted, the cost required for system configuration can be reduced.

By employing the control device 100 according to the present embodiment,because wiring (I/O signal line) between controllers can be realized bysoftware, time and cost required for design and implementation can bereduced.

It will be apparent to those skilled in the art that variousmodifications and variations can be made to the disclosed embodimentswithout departing from the scope or spirit of the disclosure. In view ofthe foregoing, it is intended that the disclosure covers modificationsand variations provided that they fall within the scope of the followingclaims and their equivalents.

What is claimed is:
 1. A control device for controlling a controlobject, the control device comprising: a storage unit storing a firstprogram to be scanned as a whole for each execution and a second programthat is sequentially executed; an execution processing unit computing afirst command value by executing the first program at everypredetermined control cycle; an interpreter interpreting at least a partof the second program and generating an intermediate code; a commandvalue computation unit computing a second command value at every controlcycle according to the intermediate code generated in advance by theinterpreter; and an output unit outputting the first command valuecomputed by the execution processing unit and the second command valuecomputed by the command value computation unit at every control cycle.2. The control device according to claim 1, wherein the interpreterupdates data shared with the execution processing unit at everysynchronization cycle, which is an integer multiple of the controlcycle.
 3. The control device according to claim 2, wherein theinterpreter temporarily stops interpretation of the second programbefore the synchronization cycle comes.
 4. The control device accordingto claim 1, wherein the intermediate code includes a function for thecommand value computation unit to compute the second command value atevery control cycle.
 5. The control device according to claim 2, whereinthe intermediate code includes a function for the command valuecomputation unit to compute the second command value at every controlcycle.
 6. The control device according to claim 3, wherein theintermediate code includes a function for the command value computationunit to compute the second command value at every control cycle.
 7. Thecontrol device according to claim 1, wherein the interpretersequentially queues the generated intermediate code to the buffer, andthe command value computation unit reads the intermediate code in anorder in which the intermediate code is queued in the buffer.
 8. Thecontrol device according to claim 2, wherein the interpretersequentially queues the generated intermediate code to the buffer, andthe command value computation unit reads the intermediate code in anorder in which the intermediate code is queued in the buffer.
 9. Thecontrol device according to claim 3, wherein the interpretersequentially queues the generated intermediate code to the buffer, andthe command value computation unit reads the intermediate code in anorder in which the intermediate code is queued in the buffer.
 10. Thecontrol device according to claim 4, wherein the interpretersequentially queues the generated intermediate code to the buffer, andthe command value computation unit reads the intermediate code in anorder in which the intermediate code is queued in the buffer.
 11. Thecontrol device according to claim 1, wherein the intermediate codeincludes a function that takes time of the control cycle as an input anda command value as an output.
 12. The control device according to claim2, wherein the intermediate code includes a function that takes time ofthe control cycle as an input and a command value as an output.
 13. Thecontrol device according to claim 3, wherein the intermediate codeincludes a function that takes time of the control cycle as an input anda command value as an output.
 14. The control device according to claim4, wherein the intermediate code includes a function that takes time ofthe control cycle as an input and a command value as an output.
 15. Thecontrol device according to claim 1, comprising a plurality of sets ofthe interpreter and the command value computation unit.
 16. The controldevice according to claim 1, wherein the execution processing unit, thecommand value computation unit, and the output unit are executed as highpriority task, and the interpreter is executed as a low priority task.17. The control device according to claim 2, wherein the executionprocessing unit, the command value computation unit, and the output unitare executed as high priority task, and the interpreter is executed as alow priority task.
 18. The control device according to claim 3, whereinthe execution processing unit, the command value computation unit, andthe output unit are executed as high priority task, and the interpreteris executed as a low priority task.
 19. The control device according toclaim 16, wherein an execution time of the high priority task isassigned to each control cycle, and the low priority task is executed ata time other than the execution time of the high priority task.
 20. Thecontrol device according to claim 16, wherein the control device has aprocessor having a plurality of cores, the high priority task isexecuted in a first core, and the low priority task is executed in asecond core.